package cn.zysuyuan.item.utils;

/**
 * @author flypig
 * @version 1.0
 * @date 2020-02-15 23:22
 */

import cn.zysuyuan.common.entity.ChartData;
import cn.zysuyuan.item.entity.DeviceData;

import java.util.List;

/**
 * 生成图表数据
 */
public class CaculateChartData {

    /**
     * 根据设备名称给chartData赋值
     */
    public static void JudgeDevice(String name, ChartData chartData, List<DeviceData> list, int i) {
        if (name.equals("Temperature")) {
            chartData.setData(list.get(i).gettTemperature());
            chartData.setCreateTime(list.get(i).gettCreateTime());
        }
        else if (name.equals("Humidity")) {
            chartData.setData(list.get(i).gettHumidity());
            chartData.setCreateTime(list.get(i).gettCreateTime());
        }
        else if (name.equals("SoilTemperature")) {
            chartData.setData(list.get(i).gettSoilTemperature());
            chartData.setCreateTime(list.get(i).gettCreateTime());
        }
        else if (name.equals("SoilHumidity")) {
            chartData.setData(list.get(i).gettSoilHumidity());
            chartData.setCreateTime(list.get(i).gettCreateTime());
        }
        else if (name.equals("LightIntensity")) {
            chartData.setData(list.get(i).gettLightIntensity());
            chartData.setCreateTime(list.get(i).gettCreateTime());
        }
        else if (name.equals("SoilPh")) {
            chartData.setData(list.get(i).gettSoilPh());
            chartData.setCreateTime(list.get(i).gettCreateTime());
        }
    }

}


